var Player = require('player');
 
// create player instance 
var player = new Player('/Users/davidzhang/Downloads/yueliangzhishang.mp3');
 
// play now and callback when playend 
player.play(function(err, player){
  console.log('playend!');
});

// play again 
// player.play();
 
// play the next song, if any 
// player.next();
 
// add another song to playlist 
player.add('/Users/davidzhang/Downloads/yueliangzhishang.mp3');
player.add('/Users/davidzhang/Downloads/孤独的人是可耻.mp3');
player.add('/Users/davidzhang/Downloads/small_apple.mp3');
 
// list songs in playlist 
console.log(player.list)
 
// event: on playing 
player.on('playing',function(item){
  console.log('im playing... src:' + item);
});
 
// event: on playend 
player.on('playend',function(item){
  // return a playend item 
  console.log('src:' + item + ' play done, switching to next one ...');
  player.next();
});
 
// event: on error 
player.on('error', function(err){
  // when error occurs 
  console.log(err);
});
 
// stop playing 
player.stop();